/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 *
 * @author Misja
 */
public class Message implements Serializable{
    private int id;
    private String message;
    private String title;
    private Twitterer owner;
    private Set<Twitterer> likes = new HashSet<Twitterer>();

    public Message() {
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    
    public Message(Twitterer owner) {
        this.owner = owner;
        this.likes = new HashSet<Twitterer>();
    }
    
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Twitterer getOwner() {
        return owner;
    }

    public void setOwner(Twitterer owner) {
        this.owner = owner;
    }

    public Set<Twitterer> getLikes() {
        return likes;
    }

    public void setLikes(Set<Twitterer> likes) {
        this.likes = likes;
    }
    
    public void setLike(Twitterer twitterer){
        this.likes.add(twitterer);
    }
    
    public String likesToString(){
        String msg = "";
        for (Twitterer tw : likes) {
            msg = msg + ";" + tw.getUserName();
        }
        return msg;
    }
}
